package com.springStudy.com.aopStudy.staticProxy;

import com.springStudy.com.aopStudy.Calculator;

public class StaticProxyCalculator implements Calculator {

    private Calculator target;

    public StaticProxyCalculator(Calculator target) {
        this.target = target;
    }

    @Override
    public int add(int a, int b) {
        System.out.println("a = " + a + ", b = " + b);
        int result = target.add(a, b);
        System.out.println("result = " + result);
        return result;
    }

    @Override
    public int sub(int a, int b) {
        System.out.println("a = " + a + ", b = " + b);
        int result = target.sub(a, b);
        System.out.println("result = " + result);
        return result;
    }

    @Override
    public int mul(int a, int b) {
        System.out.println("a = " + a + ", b = " + b);
        int result = target.mul(a, b);
        System.out.println("result = " + result);
        return result;
    }

    @Override
    public int div(int a, int b) {
        System.out.println("a = " + a + ", b = " + b);
        int result = target.div(a, b);
        System.out.println("result = " + result);
        return result;
    }
}
